/*---------------------------------------------------------------------------
 *-Version :0.1 @ 08/20/2008                                                *
 *-Auther : Chen Ju                                                         *
 *-Auther Email: sammy105@gmail.com                                         *
 *-Auther site : http://www.kylogs.com/blog                                 * 
 *-This file defines all data types and declares all data-structure         * 
 *-related funcitons.                                                       * 
 *---------------------------------------------------------------------------
 */

/* define c_stack  */
typedef struct easyc_stack{
               int base_size;
               int point;
               int * base;
               int size;
               int  (*pop)(struct easyc_stack *);
               int  (*push)(int,struct easyc_stack *);
               int  (*get_top)(struct easyc_stack *);
               void (*del)(struct easyc_stack *);
        }c_stack;



/*declare stack funcitons*/
int easyc_pop(c_stack *);

int easyc_push(int ,c_stack *);

int easyc_get_top(c_stack *);

void easyc_del(c_stack *);

c_stack make_stack(int size);



/* define c_linkedlist and c_list */
typedef struct easyc_list{
    struct easyc_list * next;
    struct easyc_list * pre;
    int element;    
}c_list;

typedef struct easyc_linkedlist{
    int size;
    c_list * head;
    c_list *(*find)(int, const struct easyc_linkedlist *);
    int (*contains)(int, const struct easyc_linkedlist *);
    void (*insert)(int,const c_list *,struct easyc_linkedlist *);
    void (*append)(int,struct easyc_linkedlist *);
    void (*remove)(c_list *,struct easyc_linkedlist *);
}c_linkedlist;        

/* declare linkedlist functions */
c_linkedlist linkedlist_make();
c_list *easyc_list_find(int, const struct easyc_linkedlist *);
int easyc_list_contains(int, const struct easyc_linkedlist * );
void easyc_list_insert(int,const c_list *,struct easyc_linkedlist *);
void easyc_list_append(int,struct easyc_linkedlist * );
void easyc_list_remove(c_list *,struct easyc_linkedlist *);

/* define c_vector */
typedef struct easyc_vector{
    int size;
    int base_size;
    int *base;
    int (*get)(int, const struct easyc_vector *);
    void (*set)(int,int,const struct easyc_vector *);
    int (*remove)(int,struct easyc_vector *);
    void (*sort)(int(* compare)(const void *,const void *));
}c_vector;

/* declare c_vector functions */
c_vector make_vector();
int easyc_get(int, const struct easyc_vector *);
void easyc_set(int,int,const struct easyc_vector *);
int easyc_remove(int,struct easyc_vector *);
void easyc_sort(int(* compare)(const void *,const void *));
